home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ Users Group Library 1996 July
/
C-C++ Users Group Library July 1996.iso
/
listings
/
v_10_04
/
1004090b
< prev
next >
Wrap
Text File
|
1992-02-08
|
478b
|
29 lines
void push(stack *, int);
int pop(stack *);
main()
{
int size = 50;
stack3.pstack = malloc(size * sizeof(int));
if (stack3.pstack == NULL) {
printf("Can't allocate space for stack3\n");
exit(1);
}
stack3.max_stack = size;
push(&stack1, 10);
push(&stack1, 12);
push(&stack2, 15);
push(&stack3, 20);
printf("stk1: %d\n", pop(&stack1));
printf("stk2: %d\n", pop(&stack2));
printf("stk3: %d\n", pop(&stack3));
printf("stk3: %d\n", pop(&stack3));
return 0;
}